<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改银河票务用户')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-user-edit" th:object="${user}">
			<input id="userId" name="userId"  type="hidden" th:field="*{userId}" />
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">用户账号：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="userAccount" id="userAccount" th:field="*{userAccount}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">mz操作id：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="mzOperateId" id="mzOperateId" th:field="*{mzOperateId}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">x mz session：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="xMzSession" id="xMzSession" th:field="*{xMzSession}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
						<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
					</div>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "galaxy/user";
	
		$("#form-user-edit").validate({
			onkeyup: false,
			rules:{
				dictType:{
					minlength: 5,
					remote: {
		                url: prefix + "/checkUserAccountUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	userId : function() {
		                        return $("#userId").val();
		                    },
		                	userAccount : function() {
		                		return $.common.trim($("#userAccount").val());
		                    }
		                }
		            }
				},
			},
			messages: {
		        "userAccount": {
		            remote: "该用户账号已经存在"
		        }
		    },
		    focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/edit", $('#form-user-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
